import 'package:flutter/material.dart';

class GoodDetailPage extends StatefulWidget {
  static final String goodIdKey = 'goodId';
  static final String callbackKey = 'callback';
  final Map arguments;
  GoodDetailPage({Key key, this.arguments}) : super(key: key);

  @override
  _GoodDetailPageState createState() => _GoodDetailPageState();
}

class _GoodDetailPageState extends State<GoodDetailPage> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Container(
        child: Scaffold(
          appBar: AppBar(
            title: Text('GoodDetailPage'),
          ),
          body: Column(
            children: <Widget>[
              Text(
                'goodId is ${widget.arguments != null ? widget.arguments[GoodDetailPage.goodIdKey] : '1'}',
              ),
              RaisedButton(
                onPressed: () {
                  widget.arguments[GoodDetailPage.callbackKey]();
                },
                child: Text('回调'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
